﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using PromotionApp.Model;
using PromotionApp.BLL;


namespace PromotionApp.Utility
{
    public abstract class BasePage : Page
    {
        #region Protected Variable

        protected readonly string _CookieName = "un";
        protected readonly string _CookieKey = "key";
        //protected UserRole _UserRole = UserRole.Undefined;
        protected string _UserRole = string.Empty;
        protected string _Identity = string.Empty;
        protected InternalUser _User = null;

        #endregion

        #region Protected Method

        protected abstract void ValidateUserRole();

        
        protected void GetUserRoleNew()
        {
            //HttpCookie cookie = this.Request.Cookies[this._CookieName];

            //if (cookie != null)
            //{
            //    if (!string.IsNullOrEmpty(cookie[this._CookieKey]))
            //    {
            //        this._Identity = cookie[this._CookieKey].Trim();
            //        this._UserRole = InternalUserBLL.GetInstance().GetUserRole(this._Identity, out this._User);
            //    }
            //}

            try
            {
                this._UserRole = Session["USER_TYPE"].ToString();

                if (!string.IsNullOrEmpty(this._UserRole))
                {
                    this._UserRole = Session["USER_TYPE"].ToString();
                   
                }
            }
            catch (Exception ex)
            {

            }

        }
        #endregion

        #region Property

        //protected override bool AllowAnonymousAccess
        //{
        //    get
        //    {
        //        return true;
        //    }
        //UnsecuredLayoutsPageBase
        //}

        #endregion

    }
}